/**
* 功能描述：年份选择器样式表
* @author jin xiaohang
* @date 2022/9/28 20:46
* @version 1.0
*/
@import "src/style/mixins/index";

//定义全局布局
@mixin year-picker-layout{

  //外层容器布局
  .#{$namespace}-year-picker-panel{
    display: flex;
    width: 100%;
    height: 100%;
    flex-direction: column;

    //头部布局
    .#{$namespace}-year-picker-panel-header{
      height: 40px;
      line-height: 40px;
      text-align: center;
      user-select: none;
      position: relative;

      //上一年按钮布局
      .#{$namespace}-year-picker-panel-prev-year-btn{
        left: 7px;
        height: 100%;
        position: absolute;
        top: 0;
        display: inline-block;
        padding: 0 5px;
        line-height: 40px;

        &::before{
          @include year-picker-layout-before-after;
          transform: rotate(-45deg) scale(.8);
        }

        &::after{
          @include year-picker-layout-before-after;
          left: -3px;
          transform: rotate(-45deg) scale(.8);
        }

      }

      //下一年按钮布局
      .#{$namespace}-year-picker-panel-next-year-btn{
        right: 7px;
        height: 100%;
        position: absolute;
        top: 0;
        display: inline-block;
        padding: 0 5px;
        line-height: 40px;

        &::before{
          left: 3px;
          transform: rotate(135deg) scale(.8);
          @include year-picker-layout-before-after;
        }

        &::after{
          @include year-picker-layout-before-after;
          transform: rotate(135deg) scale(.8);
        }
      }

      //年份布局
      .#{$namespace}-year-picker-panel-year-select{
        line-height: 40px;
      }
    }

    //主要部分布局
    .#{$namespace}-year-picker-panel-body{

      //待选面板表格布局
      .#{$namespace}-year-picker-panel-table{
        width: 100%;
        height: 100%;
        table-layout: fixed;
        border-collapse: separate;

        //表格单元格布局
        .#{$namespace}-year-picker-panel-cell{
          text-align: center;
          height: 60px;

          //表格数据布局
          .#{$namespace}-year-picker-panel-data{
            display: inline-block;
            height: 24px;
            margin: 0 auto;
            padding: 0 8px;
            line-height: 24px;
            text-align: center;
          }
        }
      }
    }
  }
}

//提取插入公共部分
@mixin year-picker-layout-before-after{
  position: relative;
  top: -1px;
  display: inline-block;
  width: 8px;
  height: 8px;
  vertical-align: middle;
  border: solid #aaa;
  border-width: 1.5px 0 0 1.5px;
  border-radius: 1px;
  transition: all .3s;
  content: "";

}

//定义样式
@include b(year-picker){
  height: 100%;
  width: 100%;
  max-width: 278px;
  max-height: 288px;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 10;
  background: #fff;
  border-radius: 2px;
  outline: none;
  box-shadow: 0 2px 8px #00000026;

  //头部样式
  .#{$namespace}-year-picker-panel-header{
    border-bottom: 1px solid #f0f0f0;

    //前一年按钮样式
    .#{$namespace}-year-picker-panel-prev-year-btn{
      color: #00000073;
      font-size: 16px;
      &:hover{
        cursor: pointer;
      }
    }

    //后一年按钮样式
    .#{$namespace}-year-picker-panel-next-year-btn{
      color: #00000073;
      font-size: 16px;
      &:hover{
        cursor: pointer;
      }
    }

    //年份样式
    .#{$namespace}-year-picker-panel-year-select{
      color: #000000d9;
      font-weight: 500;
      &:hover{
        cursor: pointer;
        color: #40a9ff;
      }
    }
  }

  //不在包含范围内得样式
  .#{$namespace}-year-picker-panel-not-include-data{
    color: #d2d1d1;
  }

  //表格数据样式
  .#{$namespace}-year-picker-panel-data{
    background: transparent;
    border-radius: 2px;
    transition: background .3s ease;

    &:hover{
      cursor: pointer;
      background-color: #F5F5F5;
      color: #409EFF;
    }
  }

  //选中数据样式
  .#{$namespace}-year-picker-selected-data{
    background-color:#409EFF ;
    color: #FFFFFF ;
    &:hover{
      cursor: pointer;
      background-color: #409EFF;
      color: #FFFFFF;
    }
  }

  //引用布局
  @include year-picker-layout;

}